import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:guochaoapp/controller/shopping/shopping_controller.dart';
import 'package:guochaoapp/controller/shopping/shopping_payment_success_controller.dart';
import 'package:guochaoapp/routes/app_pages.dart';

import '../../r.dart';

class GCPaymentSuccessPage extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return Scaffold(body: _initSubviews());
  }

  _initSubviews() {
    GCShoppingPaymenntSuccessController c = Get.put(GCShoppingPaymenntSuccessController());

    return Column(
      children: [
        Container(
          height: 208,
          color: Color(0xFF40A8B3),
          child: Column(
            children: [
              SizedBox(
                height: ScreenUtil().statusBarHeight,
              ),
              Container(
                height: 44,
                child: Align(
                    child: Text("订单支付成功",
                        style: TextStyle(
                            fontSize: 16,
                            fontWeight: FontWeight.bold,
                            color: Colors.white))),
              ),
              SizedBox(height: 40),
              Container(
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Image.asset(R.assetsIconPaySuccess, height: 44, width: 44),
                    SizedBox(width: 12),
                    Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Row(children: [
                          Text("支付成功!",
                              style:
                              TextStyle(fontSize: 18, color: Colors.white))
                        ]),
                        SizedBox(height: 5),
                        Row(children: [
                          Text(c.getTitleTipText(),
                              style:
                              TextStyle(fontSize: 16, color: Colors.white))
                        ]),
                      ],
                    )
                  ],
                ),
              ),
              SizedBox(height: 20),
              Row(mainAxisAlignment: MainAxisAlignment.center, children: [
                Text("订单已支付成功,正在为您准备商品",
                    style: TextStyle(
                        color: Colors.white, fontWeight: FontWeight.w200))
              ])
            ],
          ),
        ),
        Container(
            height: ScreenUtil().screenHeight - 208,
            color: Colors.white,
            child: Container(
              padding: EdgeInsets.only(left: 20, right: 20),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  SizedBox(height: 20),
                  Text("订单信息",
                      style:
                      TextStyle(fontSize: 16, fontWeight: FontWeight.w500)),
                  SizedBox(height: 8),
                  Text("订单支付成功,商品准备中"),
                  SizedBox(height: 4),
                  Text("由果巢为您配送,配送进度请进入订单详情查看"),
                  SizedBox(height: ScreenUtil().setSp(70)),
                  Container(
                    width: ScreenUtil().setSp(320),
                    height: ScreenUtil().setSp(42),
                    child: FlatButton.icon(
                      icon: Image.asset(R.assetsIconOrder,
                          height: ScreenUtil().setSp(18),
                          width: ScreenUtil().setSp(18)),
                      label: Text("查看订单"),
                      padding: EdgeInsets.zero,
                      color: Color(0xFF40A8B3),
                      textColor: Colors.white,
                      shape: RoundedRectangleBorder(
                          borderRadius: BorderRadius.all(Radius.circular(4))),
                      onPressed: () {
                        c.toDetail();
                      },
                    ),
                  ),
                  SizedBox(height: ScreenUtil().setSp(24)),
                  Container(
                    width: ScreenUtil().setSp(320),
                    height: ScreenUtil().setSp(42),
                    child: OutlineButton.icon(
                      icon: Image.asset(R.assetsIconBackHome,
                          height: ScreenUtil().setSp(18),
                          width: ScreenUtil().setSp(18)),
                      label: Text("回到首页"),
                      padding: EdgeInsets.zero,
                      // color: Color(0xFF40A8B3),
                      textColor: Color(0xFF999999),
                      shape: RoundedRectangleBorder(
                          borderRadius: BorderRadius.all(Radius.circular(4))),
                      onPressed: () {
                        Get.until((route) => Get.currentRoute == Routes.INITIAL);
                        GCShoppingController shopping_c = Get.find();
                        shopping_c.requestInitData();
                        // c.jumpToList(c.settleData.itemList);
                      },
                    ),
                  ),
                ],
              ),

            )),
      ],
    );
  }
}